package com.stores.model;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;

import com.google.appengine.api.rdbms.AppEngineDriver;

public class CloudDb {
	
	private String connectionString=null;
	
	/**
	 * 
	 * @throws SQLException
	 */
	public CloudDb() throws SQLException {
		this("jdbc:google:rdbms://ionlinestoresdb:default/ionlinestores");
	}
	
	/**
	 * 
	 * @param connectionString
	 * @throws SQLException
	 */
	public CloudDb(String connectionString) throws SQLException {
		DriverManager.registerDriver(new AppEngineDriver());
		this.connectionString = connectionString;
	}
	
	/***
	 * 
	 * @return
	 * @throws SQLException
	 */
	public Connection getConnection() throws SQLException{
		return DriverManager.getConnection(this.connectionString, "ultrauser","b790-43c70b1b6ca2");
		//return DriverManager.getConnection(this.connectionString);
	}
}
